/*
 * SPDX-License-Identifier: BSD-3-Clause
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved.
 * Description   : udk pci header file
 */

#ifndef UDK_PCI_H
#define UDK_PCI_H

#include <stdint.h>
#include <inttypes.h>

/* Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
#define UDK_PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
#define UDK_PCI_FMT_NVAL 4

struct udk_pci_addr {
    uint32_t domain;    /* Device domain */
    uint8_t bus;        /* Device bus */
    uint8_t devid;      /* Device ID */
    uint8_t function;   /* Device function */
    uint8_t rsvd;
};

int udk_pci_addr_parse(const char *str, struct udk_pci_addr *addr);

#endif